Skip to content

feat(platform): inject x-uipath-traceparent-id on all outbound HTTP requests#1535

Merged
cfauchere merged 7 commits intomainfrom
feat/inject-trace-context-headers
Apr 1, 2026
Merged

feat(platform): inject x-uipath-traceparent-id on all outbound HTTP requests#1535
cfauchere merged 7 commits intomainfrom
feat/inject-trace-context-headers

Conversation

@cfauchere
Copy link
Copy Markdown
Contributor

Summary

  • Inject x-uipath-traceparent-id header on every outbound HTTP request from BaseService
  • Covers both sync (request) and async (request_async) paths
  • All downstream services (ECS, Orchestrator, LLM Gateway) receive the trace context

Context

Today there is no way to correlate agent traces with downstream service logs. When a DeepRAG call fails with "DeepRAG content not available", the agent trace has no operation ID and ECS has no trace ID — complete dead end for debugging.

Per the TraceView client SDK spec, the x-uipath-traceparent-id header uses W3C format: 00-{trace_id}-{span_id}-{trace_flags}. The trace/span IDs come from the active OTEL span context (set by @traced decorators on SDK methods).

Changes

  • _base_service.py: Added _inject_trace_context() helper that reads the active OTEL span and formats the header
  • Called in both request() and request_async() before every outbound call
  • No new dependencies — opentelemetry-api is already available transitively via uipath-core

Test plan

  • Verify header is present on outbound requests when OTEL context is active
  • Verify no header is injected when no active span (no crash, no empty header)
  • Verify trace ID in header matches the agent trace ID in App Insights

🤖 Generated with Claude Code

@github-actions github-actions bot added the test:uipath-langchain Triggers tests in the uipath-langchain-python repository label Apr 1, 2026
Copy link
Copy Markdown

@RunnanJia RunnanJia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks

Clement Fauchere and others added 4 commits April 1, 2026 16:51
… HTTP requests

Adds UiPath trace context propagation to BaseService so every outbound
HTTP call (ECS, Orchestrator, LLM Gateway, etc.) carries the
x-uipath-traceparent-id header with the active OTEL trace/span IDs.

This enables downstream services to correlate requests back to agent
traces in App Insights, which is critical for debugging failures like
"DeepRAG content not available" where today there is no way to link
the agent trace to the CG service logs.

Header format follows UiPath convention (per TraceView client SDK spec):
x-uipath-traceparent-id: 00-{trace_id}-{span_id}-01

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cfauchere cfauchere force-pushed the feat/inject-trace-context-headers branch from 328833f to 9f9c0f1 Compare April 1, 2026 21:51
Clement Fauchere and others added 3 commits April 1, 2026 16:58
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cfauchere cfauchere force-pushed the feat/inject-trace-context-headers branch from bc16056 to 0c8254a Compare April 1, 2026 22:09
@cfauchere cfauchere enabled auto-merge (squash) April 1, 2026 22:09
@cfauchere cfauchere disabled auto-merge April 1, 2026 22:10
@cfauchere cfauchere enabled auto-merge (squash) April 1, 2026 22:10
@cfauchere cfauchere merged commit 4afbc8c into main Apr 1, 2026
83 checks passed
@cfauchere cfauchere deleted the feat/inject-trace-context-headers branch April 1, 2026 22:11
cfauchere pushed a commit to UiPath/uipath-langchain-python that referenced this pull request Apr 1, 2026
Picks up x-uipath-traceparent-id trace context propagation from
uipath-platform 0.1.18 (UiPath/uipath-python#1535).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cfauchere pushed a commit to UiPath/uipath-langchain-python that referenced this pull request Apr 1, 2026
Picks up x-uipath-traceparent-id trace context propagation from
uipath-platform 0.1.18 (UiPath/uipath-python#1535).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cfauchere pushed a commit to UiPath/uipath-langchain-python that referenced this pull request Apr 1, 2026
Picks up x-uipath-traceparent-id trace context propagation from
uipath-platform 0.1.18 (UiPath/uipath-python#1535).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants